package com.climber.android.commonsdk.util

import java.util.regex.Pattern

/**
 * Created by Mikes at 2020-04-07 16:17
 */
object PhonePatternUtil {
    private val taiwanPhone = Pattern.compile("^\\+886\\d{10}$")
    private val macaoPhone = Pattern.compile("^\\+853\\d{8}$")
    private val hongkongPhone = Pattern.compile("^\\+852\\d{8}$")
    private val mainlandPhone = Pattern.compile("^\\+86((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$")

    @JvmStatic
    fun isSupportAreaMobileNumber(phoneNumber: String): Boolean {
        return hongkongPhone.matcher(phoneNumber).matches()
                || mainlandPhone.matcher(phoneNumber).matches()
                || macaoPhone.matcher(phoneNumber).matches()
                || taiwanPhone.matcher(phoneNumber).matches()
    }
}